﻿#include "table_row_operator_widget.h"
#include "ui_table_row_operator_widget.h"

TableRowOperatorWidget::TableRowOperatorWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TableRowOperatorWidget),
    m_tableData(nullptr)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_StyledBackground);
    initEvents();
}

TableRowOperatorWidget::~TableRowOperatorWidget()
{
    delete ui;
}

void TableRowOperatorWidget::setTableData(PrjTableData *tableData)
{
    m_tableData = tableData;
}

PrjTableData *TableRowOperatorWidget::tableData()
{
    return m_tableData;
}

void TableRowOperatorWidget::initEvents()
{
    connect(ui->editBtn, &QPushButton::clicked, this, [=]() {
        emit(editData());
    });

    connect(ui->deleteBtn, &QPushButton::clicked, this, [=]() {
        emit(deleteData());
    });
}
